class Tasklet
	include DataMapper::Resource
	include MatrixHelpers::DM

	property :id,   Serial
	property :name, String, :length => 96
	property :description, Text
	property :important, Boolean, :default => false
	property :urgent, Boolean, :default => false

	property :status, String, :default => "new"

	property :created_at, DateTime
	property :updated_at, DateTime

	property :due, DateTime
	property :finished_at, DateTime

	belongs_to :user, :required => false
	belongs_to :project, :required => false

	has n, :traces

	has 1, :assignment
	has n, :monitors

	def finished?
		return true if finished_at
		true if status == 'closed'
	end

	def assign_to
		self.assignment.user if self.assignment and self.assignment.user
	end

end

